<?php
include 'konek.php';
session_start();
if(!isset($_SESSION['admin']))
   {   
echo '<script language="javascript">alert("anda blm login");
document.location="index.html"</script>';
}
else
{
$username = $_SESSION['admin'];
}


$judul=$_POST['judul'];
$image=$_POST['image'];
$isi=$_POST['area'];
$sql= mysql_query("insert into posting (judul, author, isi) values ('$judul','$username','$isi')")or die(mysql_error());
$id=mysql_query("select idpost from posting where author='$username' and judul='$judul'");
$no=mysql_fetch_assoc($id);
$post=$no['idpost'];

/*simpan file*/
if(!is_null($image))
{
	$save1=mysql_query("insert into file (id_post,nm_file) values ('$post','$image')");
}
header('location:../homepage.php');
?>